package com.momo.points;

import com.momo.points.anno.AutoIdempotent;
import com.momo.points.token.TokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    @Autowired
    TokenService tokenService;

    @GetMapping("/gettoken")
    public String getToken(){
        return tokenService.generateToken();
    }

    @PostMapping("/idempotent")
    @AutoIdempotent
    public String hello1(){
        return "hello";
    }

    @PostMapping("/notidempotent")
    public String hello2(){
        return "hello";
    }
}
